#ifndef WEBAPI_AMAP_BASE_H
#define WEBAPI_AMAP_BASE_H

#include <WString.h>

namespace webapi {

struct GeoLocation {
  float longitude{0.0f}; /** @brief 经度 */
  float latitude{0.0f};  /** @brief 纬度 */
};

struct GeoRectangle {
  GeoLocation leftUp;
  GeoLocation rightDown;
};

GeoLocation GetRectangleCenter(const GeoRectangle& rect);

struct AmapResponseBase {
  int status{0};
  String info;
  int infocode{0};
};

class AmapWebServiceBase {
 public:
  /// @brief 设置高德API Key
  /// @param key API Key
  /// @return true 操作成功
  bool SetAmapApiKey(const char* key);

  /// @brief 获取高德API Key
  /// @return API Key
  const char* GetAmapApiKey() const;

 private:
  char _amapApiKey[64];
};

}  // namespace webapi

#endif  // WEBAPI_AMAP_BASE_H
